<template>
  <div>
    <div>
      <el-date-picker
        v-model="value"
        type="daterange"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
      >
      </el-date-picker>
      <el-button type="primary" style="margin-left: 20px">查询</el-button>
    </div>

    <div id="myid"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";

import { ordertotal } from "@/apis/echarts";

// import getYYYYMMDDHHMMSS from '@/utils/utils'

export default {
  data() {
    return {
      value: "",
      list:{}
    };
  },
  mounted() {
    ordertotal({
      date: '["2020-06-01 00:00:00", "2020-6-10 00:00:00"]',
    }).then((res) => {
      console.log(res);
      this.list=res.data.data
            let newArr = res.data.data.map(v => {
                return v.orderTime
            });
            console.log(newArr)
      let mychart = echarts.init(document.getElementById("myid"));
      mychart.setOption({
        xAxis: {
          type: "category",
          data: [1,2,3,4,5,6,7]
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            type: "bar",
          },
        ],
      });
    });
  },
};
</script>

<style lang="less">
.el-main[data-v-fae5bece] {
  line-height: 20px;
  text-align: left;
}
#myid {
  width: 100%;
  height: 400px;
  margin-top: 30px;
}
</style>